<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>收货地址 - 外卖APP</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
    <style>
        body {
            margin: 0;
            padding: 0;
            background: #f5f5f5;
            font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
            color: #333;
        }
        .phone-container {
            width: 390px;
            height: 844px;
            margin: 20px auto;
            background: white;
            position: relative;
            overflow: hidden;
            box-shadow: 0 0 20px rgba(0,0,0,0.1);
            border-radius: 40px;
        }
        .content {
            height: 100%;
            overflow-y: auto;
            background-color: #f8f9fa;
            padding-bottom: 80px; /* 为底部按钮留出空间 */
        }
        .header {
            background: #0095ff;
            color: white;
            padding: 16px;
            position: sticky;
            top: 0;
            z-index: 100;
            display: flex;
            align-items: center;
            gap: 15px;
        }
        .back-btn {
            color: white;
            text-decoration: none;
            font-size: 20px;
            display: flex;
            align-items: center;
        }
        .header-title {
            font-size: 18px;
            font-weight: 600;
            margin: 0;
            flex-grow: 1;
            text-align: center;
            margin-right: 24px;
        }
        .address-list {
            padding: 15px;
        }
        .address-item {
            background: white;
            border-radius: 12px;
            margin-bottom: 15px;
            padding: 15px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.03);
            position: relative;
        }
        .address-header {
            display: flex;
            align-items: center;
            margin-bottom: 8px;
            gap: 10px;
        }
        .address-name {
            font-size: 16px;
            font-weight: 500;
        }
        .address-phone {
            color: #666;
            font-size: 14px;
        }
        .address-tag {
            background: rgba(0, 149, 255, 0.08);
            color: #0095ff;
            padding: 2px 8px;
            border-radius: 4px;
            font-size: 12px;
        }
        .address-detail {
            color: #333;
            font-size: 14px;
            line-height: 1.5;
            margin-bottom: 12px;
        }
        .address-actions {
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-top: 1px solid #f5f5f5;
            padding-top: 12px;
        }
        .default-address {
            display: flex;
            align-items: center;
            gap: 8px;
            color: #666;
            font-size: 14px;
        }
        .edit-btn {
            color: #0095ff;
            font-size: 14px;
            display: flex;
            align-items: center;
            gap: 4px;
            background: none;
            border: none;
            padding: 0;
            cursor: pointer;
        }
        .add-address {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            padding: 15px;
            background: white;
            box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
            z-index: 99;
            width: 100%;
        }
        .add-btn {
            background: #0095ff;
            color: white;
            border: none;
            width: 100%;
            padding: 12px;
            border-radius: 25px;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }
        .add-btn i {
            font-size: 20px;
        }
        .add-btn:hover {
            background: #0085e5;
        }
        .empty-state {
            text-align: center;
            padding: 40px 15px;
            color: #999;
        }
        .empty-state i {
            font-size: 48px;
            color: #ccc;
            margin-bottom: 15px;
        }
        .empty-text {
            font-size: 14px;
            margin-bottom: 20px;
        }
        .switch {
            position: relative;
            display: inline-block;
            width: 40px;
            height: 20px;
        }
        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }
        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            transition: .4s;
            border-radius: 20px;
        }
        .slider:before {
            position: absolute;
            content: "";
            height: 16px;
            width: 16px;
            left: 2px;
            bottom: 2px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }
        input:checked + .slider {
            background-color: #0095ff;
        }
        input:checked + .slider:before {
            transform: translateX(20px);
        }
    </style>
</head>
<body>
    <div class="phone-container">
        <div class="content">
            <div class="header">
                <a href="user.html" class="back-btn">
                    <i class="bi bi-chevron-left"></i>
                </a>
                <h1 class="header-title">收货地址</h1>
            </div>

            <div class="address-list">
                <!-- 地址项示例 -->
                <div class="address-item">
                    <div class="address-header">
                        <span class="address-name">张三</span>
                        <span class="address-phone">138****8888</span>
                        <span class="address-tag">家</span>
                    </div>
                    <div class="address-detail">
                        广东省深圳市南山区科技园南区科苑路123号科技大厦3栋5楼502室
                    </div>
                    <div class="address-actions">
                        <div class="default-address">
                            <label class="switch">
                                <input type="checkbox" checked>
                                <span class="slider"></span>
                            </label>
                            <span>设为默认地址</span>
                        </div>
                        <button class="edit-btn">
                            <i class="bi bi-pencil"></i>
                            编辑
                        </button>
                    </div>
                </div>

                <div class="address-item">
                    <div class="address-header">
                        <span class="address-name">李四</span>
                        <span class="address-phone">139****9999</span>
                        <span class="address-tag">公司</span>
                    </div>
                    <div class="address-detail">
                        广东省深圳市福田区福华三路888号福田商务大厦12楼1208室
                    </div>
                    <div class="address-actions">
                        <div class="default-address">
                            <label class="switch">
                                <input type="checkbox">
                                <span class="slider"></span>
                            </label>
                            <span>设为默认地址</span>
                        </div>
                        <button class="edit-btn">
                            <i class="bi bi-pencil"></i>
                            编辑
                        </button>
                    </div>
                </div>

                <!-- 空状态（当没有地址时显示） -->
                <div class="empty-state" style="display: none;">
                    <i class="bi bi-geo-alt"></i>
                    <div class="empty-text">还没有添加收货地址</div>
                </div>
            </div>

            <!-- 底部添加按钮 -->
            <div class="add-address">
                <a href="address-edit.html" class="add-btn">
                    <i class="bi bi-plus-circle"></i>
                    新增收货地址
                </a>
            </div>
        </div>
    </div>

    <script>
        // 默认地址切换
        document.querySelectorAll('.switch input').forEach(checkbox => {
            checkbox.addEventListener('change', function() {
                // 如果当前选中，取消其他所有选中状态
                if (this.checked) {
                    document.querySelectorAll('.switch input').forEach(cb => {
                        if (cb !== this) cb.checked = false;
                    });
                }
            });
        });
    </script>
</body>
</html> 